
<?php  	
	
	if (file_exists("wanjiaindexbbj.php")) {
		// 如果存在，直接输出
		$fileIndex = fopen("wanjiaindexbbj.php", "r");
		$htmlString = fread($fileIndex, filesize("wanjiaindexbbj.php"));
		echo $htmlString;
	} else {
		$fileIndex = fopen("wanjiaindex.php", "r");
		$htmlString = fread($fileIndex, filesize("wanjiaindex.php"));

		$htmlString = str_replace("{address}", "深圳", $htmlString);
		$htmlString = str_replace("{message}", "消息", $htmlString);
		$htmlString = str_replace("{notice}", "全球撒地方阿斯蒂芬注册V型只需重新操作v", $htmlString);

		// 商品列表
		$arr = ["中国食物", "人造船", "击剑", "三亚游", "很奇怪", "来一个", "加速度"];
		$goolist = "";
		for ($i = 0; $i < count($arr); $i++) {
			$goodlist .= "<li><div>" . $arr[$i] . "</div></li>";
		}
		$htmlString = str_replace("{goodhotlist}", $goodlist, $htmlString);
		
		$fileIndex = fopen("wanjiaindexbbj.php", "w");
		fwrite($fileIndex, $htmlString);

		echo $htmlString;
	}
	
	// 页面跳转
	exit();
	$url = "http://localhost:8888/phpdemo/messageboard/wanjiaindexbbj.php";  
	echo "<script language='javascript' 
	type='text/javascript'>";  
	echo "window.location.href='$url'";  
	echo "</script>";  
?>